$(function() {
	initLoad();
});

function initLoad() {
	var cols = ['ID', '执行类', '方法', '参数','Cron', '状态', '备注', '创建时间', '操作'];
	var models = [{
		name: 'id',
		index: 'id',
		width: 200,
		fixed: true,
		key: true,
		search: false,
		editable: false,
		editoptions: {
			readonly: true
		}
	},
	{
		name: 'beanName',
		index: 'beanName',
		searchoptions: {
			'sopt': ['cn']
		},
		editable: true,
		editrules: {
			edithidden:true,
			required:true
		},
		editoptions: {
			size: 15
		}
	},
	{
		name: 'methodName',
		index: 'methodName',
		searchoptions: {
			'sopt': ['cn']
		},
		editable: true,
		editrules: {
            required: true
        },
        editoptions: {
            size: 15
        }
	},
	{
		name: 'methodParams',
		index: 'methodParams',
		search: false,
		align: 'center',
		editable: true,
		width: 91,
	},
	{
		name: 'cronExpression',
		index: 'cronExpression',
		search: false,
		editable: true
	},
	{
		name: 'jobStatus',
		index: 'jobStatus',
		search: false,
		editable: false
	},
	{
		name: 'remark',
		index: 'remark',
		search: false,
		editable: true
	},

	{
		name: 'createTime',
		index: 'createTime',
		search: false,
		width: 200,
		formatter: function(cv, op, rb) {
			return num2Date(cv);
		}
	},
	{
		name: 'opt',
		index: 'id',
		search: false,
		formatter: function(cv, op, rb) {
			var html = '';
			if (rb.jobStatus == '1') {
				html += '<a href="/master/job/opt/' + rb.id + '" class="btn btn-info  btn-xs">&nbsp;启动</a>&nbsp;';
			} else {
				html += '<a href="/master/job/opt/' + rb.id + '" class="btn btn-danger  btn-xs">&nbsp;停止</a>&nbsp;';
			}
			return html;
		}
	}];

    var datas = {
        "sortorder": "ASC",
        "sortname":"createTime"
    };
	loadData("/master/job", "tabdiv", datas, cols, models);
}
